//
//  InProgressPicAnvVideoView.m
//  Runone
//
//  Created by ekkaLyn on 2017/3/13.
//  Copyright © 2017年 runone. All rights reserved.
//

#import "InProgressPicAndVideoView.h"
#import "SDAutoLayout.h"

@interface InProgressPicAndVideoView ()


@end


@implementation InProgressPicAndVideoView

- (InProgressPicAndVideoView *) initWithDefalutHeight:(CGFloat) height {
    return [self initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, height)];
}

-(instancetype)initWithFrame:(CGRect)frame {
    self=[super initWithFrame:frame];
    if (self) {
        [self setBackgroundColor:[UIColor clearColor]];
        
        [self configUI];
        [self layoutUI];
    }
    return self;
}

- (void) configUI {
    _picturesBtn = [[UIButton alloc] init];
    _picturesBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [_picturesBtn setTitle:@"图 片" forState:UIControlStateNormal];
    [_picturesBtn setBackgroundImage:[UIImage imageNamed:@"confirm_btn"] forState:UIControlStateNormal];
    [_picturesBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    _videoBtn = [[UIButton alloc] init];
    _videoBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [_videoBtn setTitle:@"视 频" forState:UIControlStateNormal];
    [_videoBtn setBackgroundImage:[UIImage imageNamed:@"confirm_btn"] forState:UIControlStateNormal];
    [_videoBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    [self sd_addSubviews:@[self.picturesBtn, self.videoBtn]];
}

- (void) layoutUI {
    
    self.picturesBtn.sd_layout
    .leftSpaceToView(self, 20)
    .widthIs(self.width / 2 - 20 - 10)
    .topSpaceToView(self, 00)
    .heightIs(30);
    ;
    
    self.videoBtn.sd_layout
    .widthIs(self.width / 2 - 20 - 10)
    .rightSpaceToView(self, 20)
    .heightIs(30)
    .topSpaceToView(self, 0)
    ;
    
    self.sd_equalWidthSubviews = @[self.picturesBtn, self.videoBtn];
    
    [self setupAutoHeightWithBottomView:self.videoBtn bottomMargin:0];
}


@end
